home *** CD-ROM | disk | FTP | other *** search
- #include "bbs.h"
-
- /* Loads User & User.Keys for a particular user */
-
-
- int Load_Account(int slot, struct User *hoozer, struct UserKeys *hoozer2)
- {
- BPTR fh;
- long stat;
- --slot;
-
- //strcpy(GSTR1,Cmds->BBSLoc);
- //strcat(GSTR1,"User.Data");
- strcpy(GSTR1,UserDataLoc);
- fh=Open(GSTR1,MODE_OLDFILE);
- if(fh==NULL) return(FAILURE);
-
- stat=MySeek(fh,(((long)sizeof(struct User))*(long)slot),OFFSET_BEGINNING);
- if(stat!=(((long)sizeof(struct User))*(long)slot)) {
- Close(fh);
- return(FAILURE);
- }
-
- stat=Read(fh,(char *)hoozer,sizeof(struct User));
- if(stat!=sizeof(struct User)) {
- Close(fh);
- return(FAILURE);
- }
-
- Close(fh);
-
- //strcpy(GSTR1,Cmds->BBSLoc);
- //strcat(GSTR1,"User.keys");
- strcpy(GSTR1,UserKeyLoc);
- fh=Open(GSTR1,MODE_OLDFILE);
- if(fh==NULL) return(FAILURE);
-
- stat=MySeek(fh,(((long)sizeof(struct UserKeys))*(long)slot),OFFSET_BEGINNING);
- if(stat!=(((long)sizeof(struct UserKeys))*(long)slot)) {
- Close(fh);
- return(FAILURE);
- }
-
- stat=Read(fh,(char *)hoozer2,sizeof(struct UserKeys));
- if(stat!=sizeof(struct UserKeys)) {
- Close(fh);
- return(FAILURE);
- }
-
- Close(fh);
-
- return(SUCCESS);
- }
-